package com.genexususa.eo.bing.data.results;

import com.genexususa.eo.bing.CampaignManagementServiceClasses.BatchError;
import com.genexususa.eo.bing.CampaignManagementServiceClasses.EditorialError;
import com.genexususa.eo.bing.data.GxItemException;

import javax.xml.bind.annotation.*;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Bing_TrackingIdResults")
public class GxTrackingIdResults extends GxGeneralResults {
    @XmlElementWrapper(name = "TrackingIdResultCollection")
    @XmlElement(name = "TrackingIdResult")
    public GxTrackingIdResult[] trackingIdResultCollection;

    public GxTrackingIdResults() {
        super();
    }

    public GxTrackingIdResults(int resultQuantity) {
        super();
        this.trackingIdResultCollection = new GxTrackingIdResult[resultQuantity];
    }

    public void addResult(int index, GxTrackingIdResult trackingIdResult) {
        this.trackingIdResultCollection[index] = trackingIdResult;
    }

    public void addGxExceptionError(GxItemException error, int index) {
        this.trackingIdResultCollection[index].addGxExceptionError(error, index);
    }

    public void addBatchError(BatchError error) {
        this.trackingIdResultCollection[error.getIndex()].addBatchError(error);
    }

    public void addEditorialError(EditorialError error) {
        this.trackingIdResultCollection[error.getIndex()].addEditorialError(error);
    }

    public GxTrackingIdResult[] getTrackingIdResultCollection() {
        return trackingIdResultCollection;
    }

    public void setError() {
        this.hasError = true;
    }
}
